Add module-level exports via __all__ in package __init__.py files#165
Add module-level exports via __all__ in package __init__.py files#165abelmilash-msft wants to merge 7 commits intomainfrom
Conversation
Populate __all__ in models, core, and operations package __init__.py files so public symbols are importable directly from the package namespace. Update all user-facing examples, README, and skill docs to use the new shorter import paths. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
RelationshipInfo is a dataclass — use attribute access (.relationship_schema_name, .lookup_schema_name, .relationship_id) instead of dict subscript. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace all remaining .get('Key') dict-style calls with proper
attribute access on RelationshipInfo dataclass fields.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR flattens the public import surface of the Dataverse SDK by adding package-level re-exports via __all__ in models/, core/, and operations/, and updates docs/examples to use the shorter import paths. It also fixes the RelationshipInfo usage in the relationships example to use attribute access instead of dict-style access.
Changes:
- Populate
__all__and re-export key symbols insrc/PowerPlatform/Dataverse/{models,core,operations}/__init__.py. - Update README and skill/example docs to use package-level imports (e.g.,
from ...models import Record). - Fix
RelationshipInfoexample code to use typed attributes (result.relationship_id, etc.).
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/PowerPlatform/Dataverse/operations/init.py | Re-export operation namespaces/classes from the package root. |
| src/PowerPlatform/Dataverse/models/init.py | Re-export key model types/helpers (filters, record, query builder, relationship metadata, etc.). |
| src/PowerPlatform/Dataverse/core/init.py | Re-export config/logging/errors at PowerPlatform.Dataverse.core. |
| src/PowerPlatform/Dataverse/claude_skill/dataverse-sdk-use/SKILL.md | Update documentation examples to use new package-level imports. |
| examples/basic/installation_example.py | Update example imports to use PowerPlatform.Dataverse.operations and PowerPlatform.Dataverse.core. |
| examples/basic/functional_testing.py | Update example imports to use PowerPlatform.Dataverse.models and PowerPlatform.Dataverse.core. |
| examples/advanced/walkthrough.py | Update example imports to use PowerPlatform.Dataverse.models and PowerPlatform.Dataverse.core. |
| examples/advanced/relationships.py | Update imports and fix RelationshipInfo attribute access usage. |
| examples/advanced/alternate_keys_upsert.py | Update example imports to use PowerPlatform.Dataverse.models. |
| docs/spec-module-level-exports.md | Add a spec describing the module-level export goal and rationale. |
| README.md | Update user-facing snippets to use the new package-level imports. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - `models.filters` → `eq`, `ne`, `gt`, `lt`, `ge`, `le`, `contains`, `startswith`, `endswith`, `filter_in`, `between`, `and_`, `or_`, `not_` | ||
| - `models.batch` → `BatchItemResponse`, `BatchResult` | ||
| - `models.record` → `Record` | ||
| - `models.table_info` → `TableInfo`, `ColumnInfo`, `AlternateKeyInfo` | ||
| - `models.relationship` → `OneToManyRelationship`, `ManyToManyRelationship`, `RelationshipInfo` (etc.) |
There was a problem hiding this comment.
The spec lists exports that don't match the current implementation: models.filters does not define and_/or_/not_ helpers (composition is via &, |, ~), and relationship classes are named OneToManyRelationshipMetadata/ManyToManyRelationshipMetadata (not OneToManyRelationship/ManyToManyRelationship). To avoid confusion for contributors, update this spec section to reflect the actual public symbols (or add the missing helpers/types if they are intended).
| - `models.filters` → `eq`, `ne`, `gt`, `lt`, `ge`, `le`, `contains`, `startswith`, `endswith`, `filter_in`, `between`, `and_`, `or_`, `not_` | |
| - `models.batch` → `BatchItemResponse`, `BatchResult` | |
| - `models.record` → `Record` | |
| - `models.table_info` → `TableInfo`, `ColumnInfo`, `AlternateKeyInfo` | |
| - `models.relationship` → `OneToManyRelationship`, `ManyToManyRelationship`, `RelationshipInfo` (etc.) | |
| - `models.filters` → `eq`, `ne`, `gt`, `lt`, `ge`, `le`, `contains`, `startswith`, `endswith`, `filter_in`, `between` | |
| - `models.batch` → `BatchItemResponse`, `BatchResult` | |
| - `models.record` → `Record` | |
| - `models.table_info` → `TableInfo`, `ColumnInfo`, `AlternateKeyInfo` | |
| - `models.relationship` → `OneToManyRelationshipMetadata`, `ManyToManyRelationshipMetadata`, `RelationshipInfo` (etc.) |
Agent-Logs-Url: https://github.com/microsoft/PowerPlatform-DataverseClient-Python/sessions/2358d075-c005-43e4-a521-290267f8a424 Co-authored-by: abelmilash-msft <258686066+abelmilash-msft@users.noreply.github.com>
Add test_package_exports.py: 3 tests verifying every symbol in __all__
is importable from PowerPlatform.Dataverse.{core,models,operations}.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Merge Copilot's assertIs identity checks into test_package_exports.py - Add equivalent identity tests for core and models - Remove test_operations_package_exports.py (Copilot's file) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
__all__inmodels/,core/, andoperations/package__init__.pyfiles so users can import directly from the top-level package instead of navigating submodule paths.RelationshipInfodict-style access bugs inrelationships.pyexampleBefore / After